/**
 * 
 */

function savefile(){
	var file = document.getElementById("files").files[0];
	 var fd = new FormData();
     fd.append('file', file);
     $.ajax({
         url:constUrl+'/ws/remote/app/upload',
         type:'POST',
         data:fd,
         shadeClose: true,
         processData:false,  //tell jQuery not to process the data
         contentType: false,  //tell jQuery not to set contentType
         //这儿的三个参数其实就是XMLHttpRequest里面带的信息。
         success:function (data) {
        	 layer.msg(data.data, {
                 time: 1000 //1s后自动关闭
         			});
         }
     })
}

window.onload = function(){

    var index = parent.layer.getFrameIndex(window.name);

    $('#subFile').click(function () {
        var softwareName = $("#files").val();
       
        if(softwareName==""){
            parent.layer.confirm('关键信息未全，不能添加！',{btn:['确定']});
        }else {
         var file = document.getElementById("files").files[0];
       	 var fd = new FormData();
            fd.append('file', file);
            $.ajax({
                url:constUrl+'/ws/remote/app/upload',
                type:'POST',
                data:fd,
                shadeClose: true,
                processData:false,  //tell jQuery not to process the data
                contentType: false,  //tell jQuery not to set contentType
                //这儿的三个参数其实就是XMLHttpRequest里面带的信息。
                success:function (data) {
               	 layer.msg(data.data, {
                        time: 1000 //1s后自动关闭
                			});
               	
                },complete:function(){
                	formClose();
                }
            
            })
          
        }
    });
    $('#closeIframe').click(function(){
        parent.layer.close(index);
    });
}

function formClose(){
	var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
    parent.layer.close(index); //再执行关闭 
}

